import { getUrlQuery } from "@/utils/format";
import { getQrcodeScanDetail } from "@/service/api/sp-table-code/scan";

export default {
  methods: {
    async handleDefaultScan(record) {
      // const qrcode = getUrlQuery(
      //   "https://cloudtest.xiangsaopay.com/qr?type=order&deptId=1123598813738675201&code=FHB1230000000011"
      // );
      const qrcode = getUrlQuery(record?.detail?.result);
      const deviceNo = qrcode?.code;
      if (!deviceNo) return;
      this.form.qrCode = deviceNo;
      const res = await getQrcodeScanDetail({ deviceNo });
      // console.log("扫一扫结果", record, res);
      this.isBind = res?.isBind;
      if (res?.isBind) {
        uni.showToast({
          title: "此桌码已绑定",
          icon: "none",
        });
        return;
      }
      this.isShow = true;
    },
  },
};
